<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <script>
      //  已知有以下数据：
      const data = [
        {
          sku: "1001",
          name: "iPhone 7 Plus 128G 玫瑰金色 移动联通电信4G手机",
          is5G: false,
          price: 6188,
          count: 100, // 库存
          suggestions: ["1002", "1003", "1004"], // 相关推荐
        },
        {
          sku: "1002",
          name: "iPhone 14 Pro 256G 深空灰色 移动联通电信5G手机",
          is5G: true,
          price: 9999,
          count: 100,
          suggestions: ["1001", "1003"],
        },
        {
          sku: "1003",
          name: "iPhone 14 Pro Max 256G 深空灰色 移动联通电信5G手机",
          is5G: true,
          price: 10999,
          count: 0,
          suggestions: ["1001", "1002"],
        },
        {
          sku: "1004",
          name: "iPhone 14 Pro Max 256G 白色 移动联通电信5G手机",
          is5G: true,
          price: 10999,
          count: 9,
          suggestions: ["1001"],
        },
      ]
       
        
      // 请完成以下需求：
      // 1. 找出所有5G手机
      const arr=data.filter(ele=>ele.is5G===true)
        console.log(arr);
      // 2. 找出所有有货的手机
      const arr1=data.filter(ele=>ele.count>0)
        console.log(arr1);
      // 3. 找出所有有货的5G手机
      const arr3=data.filter(ele=>ele.is5G===true && ele.is5G===true)
        console.log(arr3);
    </script>
  </body>
</html>
